def gen_func():
    try:
        yield "http://www.test.com"
    except Exception as e:
        pass
    yield 1
    yield 2
    yield 3


if __name__ == '__main__':
    gen = gen_func()
    print(next(gen))
    gen.throw(Exception, "download error")
    print(next(gen))
    gen.throw(Exception, "download error")